/*
** rt.h for RayTracer in /home/jeanma_d//Damien/Igraph/RayTracer
** 
** Made by damien jeanmaire
** Login   <jeanma_d@epitech.net>
** 
** Started on  Thu Mar 29 10:12:55 2012 damien jeanmaire
** Last update Thu Apr 26 17:06:34 2012 damien jeanmaire
*/

#ifndef		RT_H_
#define		RT_H_

#include	<math.h>
#include	<stdlib.h>
#include	<unistd.h>
#include	<mlx.h>

#define		USAGE		"Syntax : ./rt file.cnf\n"

#define		VALID_CHARS	"0123456789_-abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ"

#define		SET	0
#define		LGT	1
#define		OBJ	2

#define         KEY_ESC         65307

#define		ABS(x)		((x) > 0 ? (x) : -(x))

typedef struct	s_point
{
  int		x;
  int		y;
}		t_point;

typedef	struct	s_coord
{
  double	x;
  double	y;
  double	z;
}		t_coord;

typedef struct	s_check
{
  char		**name_info;
  int		*nb_param;
}		t_check;

typedef struct	s_mlx
{
  void		*mlx;
  void		*win;
  void		*img;
}		t_mlx;

typedef struct	s_img
{
  int		bpp;
  int		szl;
  int		endi;
  char		*data;
  t_point	size;
}		t_img;

typedef	struct	s_obj
{
  t_coord      	data;
  t_coord      	pos;
  t_coord      	rot;
  double       	n_refrac;
  double       	trans;
  double	absorb;
  double	reflec;
  double       	shiness;
  int		color;
  int		type;
  int		lim;
}		t_obj;

typedef	struct	s_lgt
{
  t_coord	pos;
  t_coord	rot;
  int		mode;
  int		color;
  double	intensity;
}		t_lgt;

typedef	struct	s_eye
{
  t_coord      	vect;
  t_coord      	pos;
  t_coord      	rot;
  int		fov;
}		t_eye;

typedef struct	s_scene
{
  t_eye		eye;
  t_point      	size;
  t_obj		*obj;
  t_lgt		*lgt;
}		t_scene;

typedef	struct	s_vect
{
  t_coord	pt;
  t_coord	vect;
}		t_vect;

/*
** gere_event.c
*/
int		gere_key(int keycode, void *param);
int		gere_expose(t_mlx *ptr);

/*
** utils.c
*/
void		my_putstr(char *str);

/*
** image.c
*/
void            my_pixel_put_to_image(t_img *img, int x, int y,
				      unsigned long color);

/*
** rt.c
*/
void		fill_image(t_mlx *ptr, t_img *img, t_scene *sc);

/*
** draw_line.c
*/
void		draw_line(t_point *pt1, t_point *pt2, t_img *img,
			  unsigned long color);

/*
** rotation.c
*/
t_coord		rotate(t_coord *coord, t_coord *rot);
t_coord		rotate_inv(t_coord *coord, t_coord *rot);

#endif		/* RT_H_ */
